using Hospital.IService;
using Hospital.Utility.ApiResult;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Hospital.WebApi.Controllers
{
        [Route("api/[controller]")]
        [ApiController]
    [Authorize]
    public class MedicineController : ControllerBase
    {
        private readonly IMedicineService _iMedicineService;
        public MedicineController(IMedicineService iMedicineService)
        {
            _iMedicineService = iMedicineService;
        }
        [HttpGet]
        public async Task<ActionResult<ApiResult>> GetMedicine()
        {
            var data = await _iMedicineService.QueryAsync();
            if (data != null) return ApiResultHelper.Success(data);
            return ApiResultHelper.Error("error");
        }
    }
}
